Add libraries field to the clusters resource - #6365
Conversation
Integration test reportCommit: 6b15637
Top 46 slowest tests (at least 2 minutes):
|
e378a6a to
e4e688e
Compare
Wire the direct engine to treat resources.clusters.*.libraries as a child-resource node, the same way permissions and grants are handled: node/type resolution, reference splitting, and plan node discovery. Co-authored-by: Isaac <no-reply@databricks.com>
Implement ResourceLibraries: installs/uninstalls cluster libraries via the Libraries API, reconciling removed libraries on update and polling for install completion on a running cluster. Registered in all.go. Note: TestAll/clusters.libraries fails until the testserver models the libraries install/uninstall/cluster-status endpoints (next step). Co-authored-by: Isaac <no-reply@databricks.com>
Add stateful fakes for the Libraries API (install, uninstall, cluster-status) so clusters.libraries runs against the in-process server. Add the TestAll fixture and classify libraries as a no-op delete alongside permissions/grants; this greens TestAll/clusters.libraries. Co-authored-by: Isaac <no-reply@databricks.com>
Add clusterLibrariesPattern (resources.clusters.*.libraries) to glob expansion, local-library collection/upload, duplicate-name checking, and patched-wheel swapping, mirroring the job task library wiring. Local whl/jar globs now build, upload to artifact_path/.internal, and rewrite to absolute workspace paths; pypi/maven entries pass through unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
Add ValidateClusterLibraries and register it in PreDeployChecks so a libraries block on a cluster errors under the terraform engine instead of being silently dropped. Cluster libraries are direct-only. Mirrors the existing lifecycle.started guard. Co-authored-by: Isaac <no-reply@databricks.com>
Adding the clusters libraries field makes DABs libraries map to the terraform databricks_cluster.library field; regenerate the mapping so reference translation and the tf-only field audit stay correct. Co-authored-by: Isaac <no-reply@databricks.com>
- clusters/libraries: direct-engine deploy installs pypi + local wheel (rewritten to its uploaded path), and removing the wheel and redeploying uninstalls it. - clusters/libraries-terraform-error: bundle plan/deploy reject cluster libraries under the terraform engine. Co-authored-by: Isaac <no-reply@databricks.com>
Enumerate the remaining LibraryInstallStatus cases in the install-wait poll and set EmbeddedSlice explicitly in DoRead's state literal. Co-authored-by: Isaac <no-reply@databricks.com>
clusters/libraries-drift (Cloud = true, direct engine): deploy a cluster with a pypi library, then assert the immediate re-plan is a no-op (0 to change). Verified on a real AWS workspace: the Libraries status API round-trips the library without drift, so no normalization is needed. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Pipelines have a native libraries field that is a plain field, not a child resource. The sub-resource wiring matched resources.*.*.libraries for every resource type, so the direct engine tried to plan pipelines.libraries as a resource and failed with 'unsupported resource type: pipelines.libraries'. Scope both GetNodeAndType and the plan pattern to clusters. Co-authored-by: Isaac <no-reply@databricks.com>
Consistency follow-up to the GetNodeAndType/plan-pattern scoping: ResourcesTypes registered a .libraries key for every resource type with a Libraries field, spuriously adding pipelines.libraries and cluster_policies.libraries. Those keys are unreachable now that GetNodeAndType is scoped, but scope this branch too so the map stays consistent and the entries don't mislead future callers. Co-authored-by: Isaac <no-reply@databricks.com>
Two CI failures in the local acceptance suite: 1. bundle/resources/clusters/libraries deployed a prebuilt wheel from ./dist/*.whl, but dist/ is gitignored so the fixture was never committed. CI's clean checkout hit 'no files match pattern: ./dist/*.whl'. Force-add the dummy wheel as a committed test input. 2. TestInvariantConfigsCoverage requires every config.ResourcesTypes key to be covered. clusters.libraries had no coverage: the scanner only understood .permissions/.grants sub-resources. Teach it .libraries too, add a pypi-only cluster_libraries invariant config, and wire it into INPUT_CONFIG. Cluster libraries are direct-only, so exclude the config from the terraform-seeded migrate subtest like the other direct-only resources. Co-authored-by: Isaac <no-reply@databricks.com>
Approval status: pending
|
|
Check if a library is changes and all others are unchanged, does only reinstalling the change library work or can others have a dependency on it and everything needs to be reinstalled |
| return nil, nil | ||
| } | ||
|
|
||
| // DoDelete is a no-op: removing individual libraries is handled by DoUpdate's uninstall diff, and |
There was a problem hiding this comment.
What happens if the entire libraries node is removed? That should be a delete on libraries
Summary
Adds a
librarieslist to theclustersresource in DABs, so libraries (whl,jar,pypi,maven,cran,egg,requirements) can be installed on an all-purpose cluster directly from a bundle. Local wheels and jars are built and uploaded automatically. Fixes #1860.Design choices
Modeled as a child resource of the cluster, installed via the Libraries API (
install/uninstall) rather than as part of cluster create/edit. Libraries have their own lifecycle: they install on a running cluster without a restart, and thecluster_idreference guarantees the cluster isRUNNINGbefore install begins.Direct engine only. Cluster libraries are rejected under the Terraform engine and only supported for Direct
Reuses the existing wheel build/upload pipeline so
whl: ./dist/*.whland other local artifacts are built and rewritten to their uploaded workspace paths, consistent with how job/task libraries already work.Testing
Acceptance tests cover deploy/install, wheel rewrite, uninstall-on-removal, the Terraform-engine rejection, and no-drift on a real workspace. The library-status API round-trips cleanly, so no normalization step is needed.